package cn.sh.tools.domain.constant;

/**
 * 企业微信常量类
 */
public class WeChatConstant {

    public static final String QUESTION_MARK = "?";
    public static final String EQUAL_SIGN = "&";
    public static final String FIELDREF_DELIM = "=";
    public static final String PARAM_SEPARATE = "|";
    public static final String NOTE_KEY_WORD = "#";
    /**
     * 接口调用最大重试次数
     */
    public static final Integer CYCLE = 1;

    /**
     * 企业ID
     */
    public static final String CORP_ID = "corpid";

    /**
     * 企业应用id
     */
    public static final String AGENT_ID = "agentId";

    /**
     * 应用的凭证密钥
     */
    public static final String CORP_SECRET = "corpsecret";

    /**
     * 接口凭证
     * 请求地址：https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=ID&corpsecret=SECRET
     * 参考：https://developer.work.weixin.qq.com/tutorial/detail/46
     */
    public static class Token {
        public static final String BASE = "https://qyapi.weixin.qq.com/cgi-bin/gettoken";

        /**
         * 存储 凭证的 key
         */
        public static final String ACCESS_TOKEN_CACHE_KEY = "accessTokenKey";
    }

    /**
     * 部门成员
     * 请求地址：https://qyapi.weixin.qq.com/cgi-bin/user/simplelist?access_token=ACCESS_TOKEN&department_id=DEPARTMENT_ID
     */
    public static class DepartmentStaff {
        public static final String BASE = "https://qyapi.weixin.qq.com/cgi-bin/user/simplelist";

        /**
         * 调用接口凭证
         */
        public static final String ACCESS_TOKEN = "access_token";

        /**
         * 获取的部门id
         */
        public static final String DEPARTMENT_ID = "department_id";

        /**
         * 1-递归获取（获取本部门以及子部门人员），0-只获取本部门
         */
        public static final String FETCH_CHILD = "fetch_child";
    }

    /**
     * 消息推送
     * 请求地址：https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=ACCESS_TOKEN
     */
    public static class MsgPut {

        public static final String BASE = "https://qyapi.weixin.qq.com/cgi-bin/message/send";

        /**
         * 调用接口凭证
         */
        public static final String ACCESS_TOKEN = "access_token";

        /**
         * 消息推送模板，以部门为单位
         */
        public static class SendMsg {
            /**
             * 天涯共此时
             */
            public static final String TYGCS = "【{}】同学，赶紧提交加班单，你是想被白嫖吗？";
        }
    }

}
